import { SYSTEM_CONFIG } from "../config/system";
import { ElNotification, ElMessage } from "element-plus";

export function messageTip(title: string, message: string, type: "info" | "success" | "warning" | "error") {
  if (SYSTEM_CONFIG.MESSAGE_INFO === "elMessage") {
    ElMessage({
      message,
      type,
      grouping: true
    });
  } else if (SYSTEM_CONFIG.MESSAGE_INFO === "elNotification") {
    ElNotification({
      title,
      message,
      type,
      dangerouslyUseHTMLString: true
    });
  }
}
export function messageSuccessTip(message: string) {
  messageTip("成功", message, "success");
}

export function messageWarningTip(message: string) {
  messageTip("注意", message, "warning");
}

export function messageErrorTip(message: string) {
  messageTip("错误", message, "error");
}

export function messageInfoTip(message: string) {
  messageTip("提示", message, "info");
}
